﻿#include "adclient.h"
#include <QApplication>
#include <QDebug>
#include <QDir>
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    // 判断当前运行环境是否为Linux或Windows。
#ifdef Q_OS_LINUX
    qDebug() << "Current OS is Linux";
#elif defined(Q_OS_WIN)
    qDebug() << "Current OS is Windows";
#else
    qDebug() << "Unknown OS";
#endif

    QString folderName = "pic";
    //QString folderPath = QDir::currentPath() + "/" + folderName;
    QString folderPath = QApplication::applicationDirPath() + "/" + folderName;

    QDir folder(folderPath);
    if (!folder.exists())
    {

        bool success = folder.mkpath("."); // 创建文件夹
        if (success)
            qDebug() << "文件夹创建成功";
        else
            qDebug() << "文件夹创建失败";
    }
    else
         qDebug() << "文件夹已存在";

    QDir::setCurrent(folderPath);// 设置文件生成路径

    AdClient w;
    w.show();

    return a.exec();
}
